<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
	<style type="text/css">
		input.btnleft{	text-align:	left;};
 	</style>
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
			$(function() {
				
				$('#btn-export').click(function(){	
					if (chkWeek()) {
						if(confirm('ダウンロードしますか？')){
							document.fm.csv.value="download";
							document.fm.submit();
						}
					}
				});
				$('#year4').change(function(){
					var year4 = this.value;
					var myDate = new Date();
					var nowtime =  myDate.getTime();
					$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
						$("#matrix_cd").children().remove();
						$("#matrix_cd").append( data ); 
					});
				});	
				$('.sort').change(function(){
					if (this.value == 2) {
						$('#tr_op3')['hide']();
						$('#tr_op2')['show']();
					}else if (this.value == 3) {
						$('#tr_op2')['hide']();
						$('#tr_op3')['show']();
					}else {
						$('#tr_op2')['hide']();
						$('#tr_op3')['hide']();
					}
				});
			});
			function chkWeek() {
				var weekid = $("#matrix_cd").val() ;
				if (weekid.length == 0){
					alert("週を選択してください");
					return false;
				 }
				return true;
			}
			function setSS( valcd, valnm ) {
				if (gPara == "shop") {
					document.fm.shop_cd.value = valcd;
					document.fm.shop_name.value = valnm;			
				}
			
				$('#dialog').dialog("close");
			}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>パターン管理</h2>
			<ul class="submenu clearfix">
				{{ if !($isG6_7) }}<li><a href="tpattern_index.php">店別配布明細検索．更新</a></li>
				<li><a href="tpattern_copy.php">店別配布明細登録</a></li>{{/if}}
				<li>店別配布明細出力</li>
				<li><a href="tpattern_shop.php">店別パターン部数ＤＬ</a></li>
				{{ if !($isG2_3) }} <li><a href="tpattern_delive.php">分納明細出力</a></li> {{/if}}
			</ul>
			<h3>店別配布明細出力</h3>
			<form name="fm" id="fm" method="get" action="tpattern_export.php" >
<table class="formTable">
					<tbody>
					<tr><th><span>※</span>年度.週</th><td>
{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}&nbsp;&nbsp;&nbsp;
{{ html_options id='matrix_cd' name='matrix_cd' options=$week  selected=$forms.matrix_cd }}
					</td></tr><tr>
							<th>ブロック</th>
							<td>
{{ html_options id='block_cd' name='block_cd' options=$block selected=$forms.block_cd }}
							</td>
						</tr><tr>
<th>AJA名</th>
<td>{{ html_radios  name='sort' class="sort" options=$sorts selected=$forms.sort separator='&nbsp;' }}&nbsp;
<span id="tr_op2"  style="display:{{if ($forms.sort == 2) }}block{{ else }}none{{ /if}};">
{{ html_options id="area_cd" name='area_cd' options=$areauser selected=$forms.area_cd }}{{ $err.area_cd }}</span> 
<span id="tr_op3"  style="display:{{if ($forms.sort == 3) }}block{{ else }}none{{ /if}};">
{{ html_options id='zone_cd' name='zone_cd'  options=$zoneuser selected=$forms.zone_cd }}{{ $err.zone_cd }}</span> 
 </td></tr><tr><th>店舗</th>
							<td>
								<input type="text" name="shop_name" value="{{ $forms.shop_name }}" class="text" readonly/>
								<input type="hidden" name="shop_cd"  value="{{ $forms.shop_cd|escape }}" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								<button type="button" id="shop_c" class = "btn_clear" rel="shop"><span>クリア</span></button>
							</td>
						</tr></table>
				<p class="button" style="text-align:center">
					<button type="button" id="btn-export" class="submit"><span>CSV出力</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>
<div id="dialog" >
		</div></div>
		{{ $footer }}
	</body>
</html>